package com.by.common.controller;

import com.by.common.bean.ResultBean;

/**
 * @author 江俊俊
 * @version 1.0
 * @description
 * @date 2025/2/14 14:07
 * @since JDK1.8
 */
public abstract class BaseController {

   protected ResultBean success(String msg){
       return handler(ApiCode.SUCCESS,msg,null);
   }
   protected ResultBean success(String msg,Object data){
       return handler(ApiCode.SUCCESS,msg,data);
   }

   protected ResultBean fail(String msg){
       return handler(ApiCode.FAIL,msg,null);
   }
   protected ResultBean fail(String msg,Object data){
       return handler(ApiCode.FAIL,msg,data);
   }

   ResultBean handler(int code,String msg,Object data){
       return new ResultBean(code,msg,data);
   }

}
